package com.jzrh.flashbee.common.core.handler;
import com.jzrh.flashbee.common.core.exception.ParamException;
import com.jzrh.flashbee.common.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    /**
     * 参数异常
     */
    @ExceptionHandler(ParamException.class)
    public Result<String> handleParamException(ParamException e){
        log.error(e.getMessage(),e);
        return Result.paramsError(e.getMessage());
    }

}
